<?php

/**
 * Created by PhpStorm.
 * User: liu85
 * Date: 2017/10/30
 * Time: 22:48
 */
namespace app\common\utils;
class ArrayUtil
{
    public static function multiToSingle($arr) {
        $resultAry = array();
        if (!(is_array($arr) && count($arr)>0)) {
            return false;
        }
        foreach ($arr AS $k=>$val) {
            if (empty($val)) {
                continue;
            }
            if (is_array($val) && count($val)>0) {
                $resultAry = array_merge($resultAry, self::multiToSingle($val));
            }else{
                if(is_array($val)){
                    $resultAry = [];
                }else{
                    $resultAry[] = $val;
                }
            }

        }
        return $resultAry;
    }

    public static function array2Uni($list){
        $newList = [];
        foreach($list as $v){
            if(empty($list) || !$list) continue;
            foreach($v as $val){
                $newList[] = $val;
            }
        }
        return $newList;
    }
}